#pragma once

typedef unsigned char UCHAR;
typedef unsigned short USHORT;
typedef unsigned long ULONG;

#define READ_SECTORS  0x20
#define READ_SECTORS_EXT  0x24
#define WRITE_SECTORS  0x30
#define WRITE_SECTORS_EXT  0x34
#define WRITE_VERIFY  0x3C
#define READ_VERIFY_SECTORS  0x40
#define READ_VERIFY_SECTORS_EXT  0x42
#define ZERO_EXT  0x44
#define WRITE_UNCORRECTABLE_EXT  0x45
#define READ_BUFFER  0xE4
#define WRITE_BUFFER  0xE8
#define SECURITY_SET_PASSWORD  0xF1
#define SECURITY_UNLOCK  0xF2
#define SECURITY_ERASE_PREPARE  0xF3
#define SECURITY_ERASE_UNIT  0xF4
#define SECURITY_FREEZE_LOCK  0xF5
#define SECURITY_DISABLE_PASSWORD  0xF6

typedef struct IDENTIFY_DEVICE_DATA
{
	USHORT GeneralConfiguration; // word 0
	USHORT NumCylinders; // word 1, obsolete
	USHORT SpecificConfiguration; // word 2
	USHORT NumHeads; // word 3, obsolete
	USHORT Retired1[2]; // word 4 - 5
	USHORT NumSectorsPerTrack; // word 6, obsolete
	USHORT VendorUnique1[3]; // word 7 - 9
	UCHAR SerialNumber[20]; // word 10 - 19
	USHORT Retired2; // word 20
	USHORT BufferSize; // word 21
	USHORT ObsoluteWord22; // word 22
	UCHAR FirmwareRevision[8]; // word 23 - 26
	UCHAR ModelNumber[40]; // word 27 - 46
	UCHAR MaximumBlockTransfer; // word 47. 01h - 10h  Maximum number of sectors that shall be transferred per interrupt on READ / WRITE MULTIPLE commands
	UCHAR VendorUnique2;
	USHORT TrustedComputing; // word 48
	USHORT Capabilities[2]; // word 49 - 50
	USHORT ObsoleteWords51[2]; // word 51 - 52
	USHORT TranslationFieldsValid; // word 53, bit 0 - Obsolete, bit 1 - words 70:64 valid, bit 2 - word 88 valid
	USHORT NumberOfCurrentCylinders; // word 54, obsolete
	USHORT NumberOfCurrentHeads; // word 55, obsolete
	USHORT CurrentSectorsPerTrack; // word 56, obsolete
	ULONG CurrentSectorCapacity; // word 57, word 58, obsolete
	USHORT CurrentMultiSectorSetting; // word 59
	ULONG UserAddressableSectors; // word 60 - 61, for 28 - bit commands
	USHORT ObsoleteWord62;
	USHORT MultiWordDMASupport; // word 63
	USHORT AdvancedPIOModes; // word 64. bit 0:1 - PIO mode supported
	USHORT MinimumMWXferCycleTime; // word 65
	USHORT RecommendedMWXferCycleTime; // word 66
	USHORT MinimumPIOCycleTime; // word 67
	USHORT MinimumPIOCycleTimeIORDY; // word 68
	USHORT  AdditionalSupported; // word 69
	USHORT ReservedWords70[5]; // word 70 - reserved.word 71:74 - Reserved for the IDENTIFY PACKET DEVICE command
	USHORT  ReservedWord75; // Word 75
	USHORT SerialAtaCapabilities[2]; // Word 76 77
	USHORT SerialAtaFeaturesSupported; // Word 78
	USHORT SerialAtaFeaturesEnabled; // Word 79
	USHORT MajorRevision; // word 80. bit 5 - supports ATA5, bit 6 - supports ATA6, bit 7 - supports ATA7, bit 8 - supports ATA8 - ACS, bit 9 - supports ACS - 2
	USHORT MinorRevision; // word 81. T13 minior version number
	USHORT CommandSetSupport[3]; // Word 82 83 84
	USHORT CommandSetActive[3]; // Word 85 86 87
	USHORT UltraDMA; // word 88. bit 0 - UDMA mode 0 is supported ... bit 6 - UDMA mode 6 and below are supported bit 8 - UDMA mode 0 is selected ... bit 14 - UDMA mode 6 is selected
	USHORT NormalSecurityEraseUnit; // word 89
	USHORT EnhancedSecurityEraseUnit; // word 90
	USHORT CurrentAPMLevel; // word 91
	USHORT MasterPasswordID; // word 92. Master Password Identifier
	USHORT HardwareResetResult; // word 93
	USHORT CurrentAcousticValue; // word 94. obsolete
	USHORT StreamMinRequestSize; // word 95
	USHORT StreamingTransferTimeDMA; // word 96
	USHORT StreamingAccessLatencyDMAPIO; // word 97
	ULONG StreamingPerfGranularity; // word 98, 99
	ULONG Max48BitLBA[2]; // word 100 - 103
	USHORT StreamingTransferTime; // word 104. Streaming Transfer Time - PIO
	USHORT DsmCap; // word 105
	USHORT PhysicalLogicalSectorSize; // word 106
	USHORT InterSeekDelay; // word 107.     Inter - seek delay for ISO 7779 standard acoustic testing
	USHORT WorldWideName[4]; // words 108 - 111
	USHORT ReservedForWorldWideName128[4]; // words 112 - 115
	USHORT ReservedForTlcTechnicalReport; // word 116
	USHORT WordsPerLogicalSector[2]; // words 117 - 118 Logical sector size(DWord)
	USHORT CommandSetSupportExt; // word 119
	USHORT CommandSetActiveExt; // word 120
	USHORT ReservedForExpandedSupportandActive[6];
	USHORT ReservedWord127; // word 127. obsolete
	USHORT SecurityStatus; // word 128
	USHORT ReservedWord129[31]; // word 129...159.Vendor specific
	USHORT CfaPowerMode1; // word 160
	USHORT ReservedForCfaWord161[7]; // Words 161 - 167
	USHORT NominalFormFactor; // Word 168
	USHORT DataSetManagementFeature; // Word 169
	USHORT AdditionalProductID[4]; // Words 170 - 173
	USHORT ReservedForCfaWord174[2]; // Words 174 - 175
	USHORT CurrentMediaSerialNumber[30]; // Words 176 - 205
	USHORT SCTCommandTransport; // Word 206
	USHORT ReservedWord207[2]; // Words 207 - 208
	USHORT BlockAlignment; // Word 209
	USHORT WriteReadVerifySectorCountMode3Only[2]; // Words 210 - 211
	USHORT WriteReadVerifySectorCountMode2Only[2]; // Words 212 - 213
	USHORT NVCacheCapabilities; // Word 214. obsolete
	USHORT NVCacheSizeLSW; // Word 215. obsolete
	USHORT NVCacheSizeMSW; // Word 216. obsolete
	USHORT NominalMediaRotationRate; // Word 217, value 0001h means non - rotating media
	USHORT ReservedWord218; // Word 218
	USHORT NVCacheOptions; // Word 219. obsolete
	USHORT WriteReadVerifySectorCountMode; // Word 220. Write - Read - Verify feature set current mode
	USHORT ReservedWord221; // Word 221
	USHORT TransportMajorVersion; // Word 222 Transport major version number
	USHORT TransportMinorVersion; // Word 223
	USHORT ReservedWord224[6]; // Word 224...229
	ULONG ExtendedNumberOfUserAddressableSectors[2]; // Words 230...233 Extended Number of User Addressable Sectors
	USHORT MinBlocksPerDownloadMicrocodeMode03; // Word 234 Minimum number of 512 - byte data blocks per Download Microcode mode 03h operation
	USHORT MaxBlocksPerDownloadMicrocodeMode03; // Word 235 Maximum number of 512 - byte data blocks per Download Microcode mode 03h operation
	USHORT ReservedWord236[19]; // Word 236...254
	USHORT CheckSum; // Word 255
}* PIDENTIFY_DEVICE_DATA;
